
// Upgrade NOTE: commented out 'float4x4 _Object2World', a built-in variable
// Upgrade NOTE: replaced '_LightMatrix0' with 'unity_WorldToLight'
// Upgrade NOTE: replaced '_Object2World' with 'unity_ObjectToWorld'
// Upgrade NOTE: replaced 'mul(UNITY_MATRIX_MVP,*)' with 'UnityObjectToClipPos(*)'


Shader  "NewWaterFlow" {

	Properties
	 {
 _MainTex ("Base (RGB)", 2D) = "white" {}
 _Scroll ("Offset", Float) = 0
 _Scale ("_Scale", Float) = 0.25
 _ScrollU ("OffsetU", Float) = 0
 _ScaleU ("_ScaleU", Float) = 1
}

	

	SubShader
     {
  Name "FORWARD"
  Tags { "LIGHTMODE"="ForwardAdd" "QUEUE"="Transparent-1" "IGNOREPROJECTOR"="true" "RenderType"="Transparent" }
  ZWrite Off
  Cull Off
  Fog {
   Color (0,0,0,0)
  }
  Blend One One

    LOD 100
	Pass
	{
	
	

	CGPROGRAM
	#pragma vertex vert
	#pragma fragment frag
	#include "UnityCG.cginc"
    //#define Fixed3(value)  fixed3(value, value,value)
	//#define Fixed4(value)  fixed4(value, value,value,value)

	struct VertexInput {
    fixed4 vertex : POSITION;
	fixed2 xlv_TEXCOORD0 : TEXCOORD0;
    //fixed2 xlv_TEXCOORD1 : TEXCOORD1;
    //fixed3 xlv_TEXCOORD2 : TEXCOORD2;
    //fixed3 xlv_TEXCOORD3 : TEXCOORD3;
    //fixed4 tangent : TANGENT;
    fixed3 normal : NORMAL;
    //fixed4 xlv_COLOR : COLOR;
	//VertexInput
	};


	struct VertexOutput {
	fixed4 pos : SV_POSITION;
    UNITY_FOG_COORDS(1)
    //fixed4 xlv_COLOR : COLOR;
	fixed2 xlv_TEXCOORD0 : TEXCOORD0;
    fixed2 xlv_TEXCOORD1 : TEXCOORD1;
    fixed3 xlv_TEXCOORD2 : TEXCOORD2;
    fixed3 xlv_TEXCOORD3 : TEXCOORD3;
    //fixed3 xlv_TEXCOORD4 : TEXCOORD4;
	//VertexOutput
	};

 
 // float4x4 _Object2World;
 //float4 float4(1,1,1,1);
 float4x4 unity_WorldToLight;
 float4 _MainTex_ST;


	

 fixed4 _LightColor0;
 sampler2D _LightTexture0;
 sampler2D _MainTex;
 float _Scroll;
 float _Scale;
 float _ScrollU;
 float _ScaleU;





	VertexOutput vert (VertexInput v)
	{
	VertexOutput o;
	//o.pos = UnityObjectToClipPos (v.vertex);
	//o.xlv_TEXCOORD0 = TRANSFORM_TEX(v.xlv_TEXCOORD0, _MainTex);
	
  fixed3 tmpvar_1;
  half3 tmpvar_2;
  float3x3 tmpvar_3;
  tmpvar_3[0] = unity_ObjectToWorld[0].xyz;
  tmpvar_3[1] = unity_ObjectToWorld[1].xyz;
  tmpvar_3[2] = unity_ObjectToWorld[2].xyz;
  float3 tmpvar_4;
  tmpvar_4 = mul(tmpvar_3 , (normalize(v.normal) * 1.0));
  tmpvar_1 = tmpvar_4;
  float3 tmpvar_5;
  float4 cse_6;
  cse_6 = mul(unity_ObjectToWorld , v.vertex);
  tmpvar_5 = (_WorldSpaceLightPos0.xyz - cse_6.xyz);
  tmpvar_2 = tmpvar_5;
  o.pos = UnityObjectToClipPos( v.vertex);
  o.xlv_TEXCOORD0 = ((v.xlv_TEXCOORD0 * _MainTex_ST.xy) + _MainTex_ST.zw);
  o.xlv_TEXCOORD1 = tmpvar_1;
  o.xlv_TEXCOORD2 = tmpvar_2;
  o.xlv_TEXCOORD3 = mul(unity_WorldToLight , cse_6).xyz;

    UNITY_TRANSFER_FOG(o,o.vertex);
   
	return o;
	}


	fixed4 frag(VertexOutput i) : SV_Target
    {
    //fixed4 tmpvar_2 = tex2D(_MainTex, i.uv);
	
  fixed4 c_1;
  fixed3 lightDir_2;
  fixed3 tmpvar_3;
  fixed tmpvar_4;
  half4 c_5;
  float2 uv_6;
  uv_6.y = (i.xlv_TEXCOORD0.y * _Scale);
  uv_6.x = (i.xlv_TEXCOORD0.x * _ScaleU);
  uv_6.x = (uv_6.x + _ScrollU);
  uv_6.y = (uv_6.y + _Scroll);
  fixed4 tmpvar_7;
  tmpvar_7 = tex2D (_MainTex, uv_6);
  UNITY_APPLY_FOG(i.fogCoord, uv_6);

  c_5 = tmpvar_7;
  half3 tmpvar_8;
  tmpvar_8 = c_5.xyz;
  tmpvar_3 = tmpvar_8;
  half tmpvar_9;
  tmpvar_9 = c_5.w;
  tmpvar_4 = tmpvar_9;
  if ((c_5.w < 0.1)) {
    discard;
  };
  half3 tmpvar_10;
  tmpvar_10 = normalize(i.xlv_TEXCOORD2);
  lightDir_2 = tmpvar_10;
  float tmpvar_11;
  tmpvar_11 = dot (i.xlv_TEXCOORD3, i.xlv_TEXCOORD3);
  fixed4 c_12;
  c_12.xyz = ((tmpvar_3 * _LightColor0.xyz) * ((
    max (0.0, dot (i.xlv_TEXCOORD1, lightDir_2))
   * tex2D (_LightTexture0, fixed2(tmpvar_11,tmpvar_11)).w) * 2.0));
  c_12.w = tmpvar_4;
  c_1.xyz = c_12.xyz;
  c_1.w = 0.0;
   return c_1;
	}
	ENDCG
	}
  }
Fallback "Diffuse"
}

